package javabasics.netty.login.client.console;

import io.netty.channel.Channel;
import javabasics.netty.login.protocol.request.MessageRequestPacket;

import java.util.Scanner;

/**
 * @Author suxiaoxiao
 * @Date 2019/9/19 23:11
 * @Version 1.0
 */
public class SendToUserConsoleCommand implements ConsoleCommand {

    @Override
    public void exec(Scanner scanner, Channel channel) {
        System.out.println("发送消息给某个用户：");

        String toUserId = scanner.next();
        String message = scanner.next();
        channel.writeAndFlush(new MessageRequestPacket(toUserId, message));
    }

}
